\(\int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx\) [192]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 9 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-x-\text {arctanh}(\cos (x)) \]

[Out]

-x-arctanh(cos(x))

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4476, 2918, 3855, 8} \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-\text {arctanh}(\cos (x))-x \]

[In]

Int[Cot[x]/(Sec[x] + Tan[x]),x]

[Out]

-x - ArcTanh[Cos[x]]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2918

Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.))/((a_) + (b_.)*sin[(e_.) + (f_
.)*(x_)]), x_Symbol] :> Dist[g^2/a, Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^n, x], x] - Dist[g^2/(b*d),
Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && EqQ[a^2
 - b^2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4476

Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x_)]^(n_.))^(p_), x_Symbol] :> Int[A
ctivateTrig[u]*Sec[c + d*x]^(n*p)*(b + a*Sin[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x) \cot (x)}{1+\sin (x)} \, dx \\ & = -\int 1 \, dx+\int \csc (x) \, dx \\ & = -x-\text {arctanh}(\cos (x)) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(20\) vs. \(2(9)=18\).

Time = 0.08 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.22 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-x-\log \left (\cos \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[Cot[x]/(Sec[x] + Tan[x]),x]

[Out]

-x - Log[Cos[x/2]] + Log[Sin[x/2]]

Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.56

method result size
default \(\ln \left (\tan \left (\frac {x}{2}\right )\right )-2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )\) \(14\)
risch \(-x +\ln \left ({\mathrm e}^{i x}-1\right )-\ln \left ({\mathrm e}^{i x}+1\right )\) \(23\)

[In]

int(cot(x)/(sec(x)+tan(x)),x,method=_RETURNVERBOSE)

[Out]

ln(tan(1/2*x))-2*arctan(tan(1/2*x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 22 vs. \(2 (9) = 18\).

Time = 0.25 (sec) , antiderivative size = 22, normalized size of antiderivative = 2.44 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-x - \frac {1}{2} \, \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) + \frac {1}{2} \, \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \]

[In]

integrate(cot(x)/(sec(x)+tan(x)),x, algorithm="fricas")

[Out]

-x - 1/2*log(1/2*cos(x) + 1/2) + 1/2*log(-1/2*cos(x) + 1/2)

Sympy [F]

\[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=\int \frac {\cot {\left (x \right )}}{\tan {\left (x \right )} + \sec {\left (x \right )}}\, dx \]

[In]

integrate(cot(x)/(sec(x)+tan(x)),x)

[Out]

Integral(cot(x)/(tan(x) + sec(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 23 vs. \(2 (9) = 18\).

Time = 0.30 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.56 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) + \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(cot(x)/(sec(x)+tan(x)),x, algorithm="maxima")

[Out]

-2*arctan(sin(x)/(cos(x) + 1)) + log(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.11 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=-x + \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right ) \]

[In]

integrate(cot(x)/(sec(x)+tan(x)),x, algorithm="giac")

[Out]

-x + log(abs(tan(1/2*x)))

Mupad [B] (verification not implemented)

Time = 22.43 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.56 \[ \int \frac {\cot (x)}{\sec (x)+\tan (x)} \, dx=2\,\mathrm {atan}\left (\frac {8}{4\,\mathrm {tan}\left (\frac {x}{2}\right )+4}-1\right )+\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right ) \]

[In]

int(cot(x)/(tan(x) + 1/cos(x)),x)

[Out]

2*atan(8/(4*tan(x/2) + 4) - 1) + log(tan(x/2))